﻿using ED.Common.BaseModel;
using ED.IService;
using ED.Model.Request;
using Microsoft.AspNetCore.Mvc;

namespace ED.Admin.Controllers
{
    /// <summary>
    /// 员工控制器
    /// </summary>
    public class EmployeeController : CommonController
    {
        private readonly IEmployeeService employeeService;

        /// <summary>
        /// 构造器
        /// </summary>
        /// <param name="employeeService">employeeService</param>
        public EmployeeController(IEmployeeService employeeService)
        {
            this.employeeService = employeeService;
        }

        /// <summary>
        /// Employee查询
        /// </summary>
        /// <param name="req"></param>
        /// <returns></returns>
        [HttpPost]
        public PageOut<EmployeeQueryRes> Page(EmployeeQueryReq req)
        {
           return employeeService.Page(req);
        }

        /// <summary>
        /// Employee新增
        /// </summary>
        /// <param name="req"></param>
        /// <returns></returns>
        [HttpPost]
        public ResponseOutput Add(EmployeeOperateReq req)
        {
            return employeeService.Add(req);
        }

        /// <summary>
        /// Employee更新
        /// </summary>
        /// <param name="req"></param>
        /// <returns></returns>
        [HttpPost]
        public ResponseOutput Update(EmployeeOperateReq req)
        {
            return employeeService.Update(req);
        }

        /// <summary>
        /// Employee删除
        /// </summary>
        /// <param name="req"></param>
        /// <returns></returns>
        [HttpPost]
        public ResponseOutput Delete(int req)
        {
            return employeeService.Delete(req);
        }
    }
}
